package cn.jiyun.controller;

import cn.jiyun.pojo.Emp;
import cn.jiyun.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class EmpController {

    @Autowired
    EmpService empService;

    @RequestMapping("findAll")
    public List<Emp> findAll() throws InterruptedException {
        //Thread.sleep(2000L);
        return empService.findAll();
    }

    @GetMapping("findById")
    public Emp findEmpById(@RequestParam("id") Integer id){
        return empService.findEmpById(id);
    }

    @GetMapping("findByIde/{id}")
    public Emp findEmpByIde(@PathVariable("id") Integer id){
        return empService.findEmpById(id);
    }
}
